package com.example.controller.before;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.entity.Notice;
import com.example.service.NoticeService;
import com.example.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "小程序公告") //swagger的注释
@CrossOrigin
@RequestMapping("/noticeBefore")
@RestController
public class NoticeControllerBefore {

    @Autowired
    private NoticeService noticeService;

    @ApiOperation(value = "获取公告")
    @GetMapping("getNotice")
    public R getNotice() {
        QueryWrapper<Notice> wrapper = new QueryWrapper<>();
        wrapper.eq("notice_id", 1);
        Notice notice = noticeService.getOne(wrapper);
        return R.ok().data("notice", notice);
    }
}
